package dragon.social.core;

/**
 * 用来记录常用的常量
 */
public class ConstantProperties {
    //--------------QQ相关url------------------
    /**
     * QQ获取access_token的api，参考以下文档
     * https://wiki.connect.qq.com/%E4%BD%BF%E7%94%A8authorization_code%E8%8E%B7%E5%8F%96access_token
     */
    /**
     * 第一步：获取Authorization Code的地址，即跳转到QQ让用户授权，并返回Authorization Code的地址。永远不会变，除非QQ自己搞事情
     */
    public static final String QQ_AUTHORIZE_URL = "https://graph.qq.com/oauth2.0/authorize";
    /**
     * 第二步：通过Authorization Code获取Access Token，即使用Authorization Code换取token的地址。永远不会变，除非QQ自己搞事情
     */
    public static final String QQ_ACCESS_TOKEN_URL = "https://graph.qq.com/oauth2.0/token";

    /**
     * 获取QQ用户信息的url
     */
    public static String QQ_GET_USER_INFO_URL = "https://graph.qq.com/user/get_user_info?oauth_consumer_key=%1$s&openid=%2$s";

    /**
     * 获取QQ用户openId的url
     */
    public static String QQ_GET_OPEN_ID_URL = "https://graph.qq.com/oauth2.0/me?access_token=%s";

    /**
     * 把ServiceProvider做成enum，规范管理
     */
    public enum SPEnum{
        QQ("qq","101542383","e711fe6b782be687727864ee12250d9e");
        private String appId;
        private String appSecret;
        private String providerId;

        SPEnum(String providerId,String appId,String appSecret){
            this.appId = appId;
            this.appSecret = appSecret;
            this.providerId = providerId;
        }

        public String getAppId() {
            return appId;
        }

        public String getAppSecret() {
            return appSecret;
        }

        public String getProviderId() {
            return providerId;
        }
    }

}
